<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script type="text/javascript" src="../js/vue.js"></script>
<body>
    <div id="root">
        <h1>欢迎学习键盘事件</h1>
        <input type="text" placeholder="请输入" @keyup.enter="showInfo($event)" />
    </div>
    <script type="text/javascript">
        Vue.config.productionTip=false //关闭开发者环境下的提示
           
        new Vue({
        el:'#root',
        data:{

        },
        methods:{
            showInfo(e){
             console.log(e.key+"=="+e.keyCode)
             console.log(e.target.value)
            }
        }
        
        })

        </script>
</body>
</html>